package com.mall.vo;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Description 用于接受前端传递数据
 * @ClassName AddressVo
 * @Author cxx
 * @Date 2023/6/10 8:27
 * @Version 1.0
 */
@Data
public class AddressVo implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 收货地址
     */
    @NotNull
    @Size(max = 255)
    @Pattern(regexp = "^([\\u4E00-\\u9FA5A-Za-z0-9_]+((省|市|自治区|特别行政区)?[\\u4E00-\\u9FA5A-Za-z0-9_]+)*(区|县)[\\u4E00-\\u9FA5A-Za-z0-9_]*([\\u4E00-\\u9FA5A-Za-z0-9_]+(街道|路|巷|弄|号)*)){1,2}$", message = "收货地址格式不正确")
    private String address;

    /**
     * 收货人
     */
    @Pattern(regexp = "^(?:[\u4e00-\u9fa5·]{2,16})$", message = "收货人姓名格式不正确")
    @NotNull
    private String receiveUser;
    /**
     * 收货人手机号
     */
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
    @NotNull
    private String phone;

}
